using FluentAssertions;
using Xunit;

namespace Sustainalytics.Entities
{
    [Trait("Category", "Unit")]
    public class ReplaceIllegalCharacters_Should
    {
        private const string NewValue = "_";

        [Fact]
        public void return_null_for_null_value()
            => ((string)null).ReplaceIllegalCharacters(NewValue).Should().Be(null);

        [Fact]
        public void return_empty_string_for_empty_string_value()
            => "".ReplaceIllegalCharacters(NewValue).Should().Be("");

        [Fact]
        public void return_value_unchanged_if_value_has_no_illegal_characters()
            => "bla".ReplaceIllegalCharacters(NewValue).Should().Be("bla");

        [Theory]
        [InlineData('\\')]
        [InlineData('/')]
        [InlineData(':')]
        [InlineData('*')]
        [InlineData('?')]
        [InlineData('"')]
        [InlineData('<')]
        [InlineData('>')]
        [InlineData('|')]
        public void return_value_with_no_illegal_characters(char illegalCharacter)
            => ($"bla{illegalCharacter}bla").ReplaceIllegalCharacters(NewValue).Should().Be($"bla{NewValue}bla");
    }
}
